
<section class="content">
    <div class="container-fluid" >
        <div class="row">
            <div class="col-12">
                <div class="card">
                    <div class="card-header">
                        <h3 class="card-title">任务管理</h3>
                    </div>
                    <!-- /.card-header -->
                    <div class="card-body">
                        <table id="example1" class="table table-bordered table-striped">
                            <thead>
                            <tr>
                                <th>任务ID</th>
                                <th>任务名称</th>
                                <th>任务Route</th>
                                <th>剩余执行次数</th>
                                <th>任务状态</th>
                                <th>返回结果</th>
                                <th>
                                    <div class="btn-group">
                                        <button type="button" class="btn btn-success">操作</button>
                                        <button type="button" class="btn btn-success dropdown-toggle dropdown-hover dropdown-icon" data-toggle="dropdown">
                                            <span class="sr-only">Toggle Dropdown</span>
                                        </button>
                                        <div class="dropdown-menu" role="menu">
                                            <a class="dropdown-item" href="#">新增任务</a>
                                        </div>
                                    </div>
                                </th>
                            </tr>
                            </thead>
                            <tbody>
                            <?php foreach ($data as $k=>$v){ ?>
                                <tr>
                                    <td><?= $v['task_id'] ?></td>
                                    <td><?= $v['task_name'] ?></td>
                                    <td><?= $v['task_src'] ?></td>
                                    <td><?= $v['task_frequency'] ?></td>
                                    <td><?= time()-strtotime($v['last_time']) < 120?'<span style="color: green;">运行中</span>':"已停止"  ?></td>
                                    <td><?= $v['task_result'] ?></td>
                                    <td>
                                        <a class="btn btn-app"><i class="fas fa-edit"></i>编辑</a>
                                        <?php if(time()-strtotime($v['last_time']) > 120){ ?>
                                            <a class="btn btn-app"><i class="fas fa-play"></i>启用</a>
                                        <?php }else{ ?>
                                            <a class="btn btn-app"><i class="fas fa-pause"></i>停用</a>
                                        <?php } ?>
                                    </td>
                                </tr>
                            <?php } ?>
                            </tbody>
                            <tfoot>
                            <tr>
                                <th>任务ID</th>
                                <th>任务名称</th>
                                <th>任务Route</th>
                                <th>剩余执行次数</th>
                                <th>任务状态</th>
                                <th>返回结果</th>
                                <th>操作</th>
                            </tr>
                            </tfoot>
                        </table>
                    </div>
                    <!-- /.card-body -->
                </div>
                <!-- /.card -->
            </div>
            <!-- /.col -->
        </div>
        <!-- /.row -->
    </div>
    <!-- /.container-fluid -->
</section>
